package com.yidian.controller.business;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yidian.pojo.business.Ad;
import com.yidian.server.business.AdService;
import com.yidian.server.goods.CategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.Map;

/**
 * @author whb
 * @create 2021-06-17 16:18
 * @desciption 广告控制类
 */
@Controller
public class AdController {
    @Reference
    private AdService adService;
    @Reference
    private CategoryService categoryService;

    @GetMapping("/index")
    public String position(Model model){
        List<Ad> lbtList = adService.findByPosition("web_index_lb");
        model.addAttribute("lbt",lbtList);

        List<Map> categoryList = categoryService.findCategoryTree();
        model.addAttribute("categoryList",categoryList);
        return "index";
    }
}
